//
//  ViewController.m
//  UI22_复习BLOCK
//
//  Created by 李劲成 on 16/4/8.
//  Copyright © 2016年 ljc. All rights reserved.
//

#import "ViewController.h"
#import "TouchView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createTouchView];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)createTouchView {
    TouchView *view = [[TouchView alloc]initWithFrame:CGRectMake(20, 100, 300, 40) ClickHandle:^(TouchView *view) {
        if (view.backgroundColor == [UIColor redColor]) {
            view.backgroundColor = [UIColor blueColor];
            self.view.backgroundColor = [UIColor yellowColor];
        }
        else {
        view.backgroundColor = [UIColor redColor];
            self.view.backgroundColor = [UIColor greenColor];
        }
    }];
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
